package com.example.withroadlogistics.Adapter;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

import com.example.withroadlogistics.R;
import com.example.withroadlogistics.model.VTaskRroute;

import java.util.List;

public class Adapter_VTaskRoute extends BaseAdapter {
    private Context context;
    private List<VTaskRroute> list;

    //private Province data;
    //布局加载器
    private LayoutInflater inflater;

public Adapter_VTaskRoute(Context context, List<VTaskRroute> list) {
        this.context = context;
        this.list = list;
        //获取系统服务
        inflater = (LayoutInflater)context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    }

    @Override
    public int getCount() {
        return list.size();
    }

    @Override
    public Object getItem(int i) {
        return list.get(i);
    }

    @Override
    public long getItemId(int i) {
        return i;
    }

    @Override
    public View getView(int i, View view, ViewGroup viewGroup) {

        view=inflater.inflate(R.layout.taskroute_item,null);

        TextView tv1=view.findViewById(R.id.routename);
        TextView tv2=view.findViewById(R.id.carid);
        TextView tv3=view.findViewById(R.id.createdate);
        TextView tv4=view.findViewById(R.id.start);
        TextView tv5=view.findViewById(R.id.ends);
        TextView tv6=view.findViewById(R.id.statetime);
        TextView tv7=view.findViewById(R.id.endtime);
        TextView tv8=view.findViewById(R.id.endIsdit);
        TextView tv9=view.findViewById(R.id.tasknote);
      //  TextView tv10=view.findViewById(R.id.routenote);

        tv1.setText(list.get(i).getRoutename());
        tv2.setText(list.get(i).getCarid());
        tv3.setText(list.get(i).getCreatedate());
        tv4.setText(list.get(i).getStart());
        tv5.setText(list.get(i).getEnds());
        tv6.setText(list.get(i).getStatetime());
        tv7.setText(list.get(i).getEndtime());
        tv8.setText(list.get(i).getEndIsdit());
        tv9.setText(list.get(i).getTasknote());
     //   tv10.setText(list.get(i).getRoutenote());
        return view;
    }
}
